// pages/review/review.js
Page({

    /**
     * 页面的初始数据
     */
    data: {
        vocabularyImgs :["schools","high_school","cet4","cet6","pu"], 
        vocabularyName :["中小学词汇","高中词汇","四级词汇","六级词汇","考研词汇"], 
        learnVocabulary: 0,
        hasMemorizedNums: 0,
        hasNums: 0,
        masterNums: 0
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad(options) {
        
    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady() {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow() {
        var app = getApp();
        wx.request({
        url: 'http://39.101.199.5:8888/SuJiWords/user/getLearn_vocabulary/'+app.globalData.loginPhoneNumber,
        method:"GET",
        success:res=>{
        this.setData({
            learnVocabulary : res.data.data
         })
         wx.request({
            url: 'http://39.101.199.5:8888/SuJiWords/Review/getReviewMsg',
            method:'POST',
            data:{
              "phoneNumber":app.globalData.loginPhoneNumber,
              "table":this.data.learnVocabulary
              },
              header:{
              'content-tupe':'application/json'
              },
              success: res=>{
                  
                  var data = JSON.parse(res.data.data);
                  this.setData({
                      hasMemorizedNums: data.hasMemorizedNums,
                      hasNums : data.hasNums,
                      masterNums :data.masterNums
                  })
              }
          })
        
        }
        
        })
        
        
    },
    toReviewStart(){
        wx.navigateTo({
          url: './reviewStart/reviewStart?table='+this.data.learnVocabulary,
        })
    }

})